package com.zcz.config.user;

import org.springframework.web.servlet.HandlerInterceptor;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

/**
 * @author 王卫帅
 */
public class LoginInterceptor implements HandlerInterceptor {
    //private Logger logger = Logger.getLogger(LoginInterceptor.class);

    // 身份认证、身份授权
    //处理执行前被执行
    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {

        System.err.println("进入拦截器");
        return true;
    }

    //在请求完成后执行
    @Override
    public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
        System.err.println("拦截器postHandle方法执行");
    }
    //该方法将在整个请求完成之后，也就是DispatcherServlet渲染了视图执行
    @Override
    public void afterCompletion(HttpServletRequest request, HttpServletResponse response, Object handler, Exception ex) throws Exception {
        System.err.println("拦截器afterCompletion方法执行");
    }

}
